package com.flmes.base.controller.api;

import com.flmes.base.base.result.Result;
import com.flmes.base.controller.vo.LoginVO;
import com.flmes.base.service.UserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: flmes
 * @Date: 2024/9/23 19:59
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public Result<String> login(@RequestBody @Validated LoginVO login) {
        return Result.success(userService.login(login.getUsername(), login.getPassword()));
    }

}
